data("dna.obj")
x<-dna.obj
## Extract parts.
# a matrix object
x[1:2,1:3]
# a Dna object, as.dna(x[1:2,1:3]) gives the same result
x[1:2,1:3,as.matrix=FALSE]
# a vector object
x[1,1:4,drop=TRUE]
## Replace parts.
#"G" "C"
x[1,1:2]
x[1,1:2]<-c("A","T")
x[1,1:2]
Run the code above in your browser using DataLab